<template>
  <div>
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/Home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>药品管理</el-breadcrumb-item>
      <el-breadcrumb-item>药品过期单</el-breadcrumb-item>
    </el-breadcrumb>
    <!--搜素-->
    <el-row>
      <el-col :span="2">
        <el-button @click="openAddDialog()" type="primary" size="small" style="float: left;font-size: 15px;background-color:darkcyan">
          创建药品过期单
        </el-button>
      </el-col>
      <el-col :span="5" :offset="6" >
        <el-select v-model="state" placeholder="请选择状态" clearable @change="search" @clear="search">
          <el-option label="请选择状态" value="-1"></el-option>
          <el-option label="待出库" value="0"></el-option>
          <el-option label="已出库" value="1"></el-option>
          <el-option label="作废" value="2"></el-option>
        </el-select>
      </el-col>
      <el-col :span="7" :offset="1">
        <el-input placeholder="请输入出库人姓名" clearable v-model="outname" @change="search" @clear="search">
          <el-button slot="append" icon="el-icon-search" @click="search"></el-button>
        </el-input>
      </el-col>
    </el-row>

    <!--展示-->
    <div>
      <template>
        <el-table
            :data="overduevoList"
            style="width: 100%"
            :row-class-name="tableRowClassName">
          <el-table-column prop="id" label="#" width="40px"></el-table-column>
          <el-table-column prop="ordernum" label="订单编号" width="150px"></el-table-column>
          <el-table-column prop="outname" label="出库人" width="120px"></el-table-column>
          <el-table-column prop="createtime" label="出库日期"></el-table-column>
          <el-table-column prop="totalprice" label="进货总价"></el-table-column>
          <el-table-column prop="desc" label="备注"></el-table-column>
          <el-table-column label="状态" >
            <template slot-scope="scope">
              <el-button type="danger" plain size="mini" v-if="scope.row.state==0">待出库</el-button>
              <el-button type="success" plain size="mini" v-if="scope.row.state==1" >已出库</el-button>
              <el-button type="info" plain size="mini" v-if="scope.row.state==2" >作废</el-button>
            </template>
          </el-table-column>

          <el-table-column label="操作" width="200px">
            <template slot-scope="scope">
              <el-button
                  style="margin-left: 10px"
                  size="mini"
                  type="success"
                  @click="searchDetail(scope.row)">查看
              </el-button>
              <el-button
                  v-if="scope.row.state==0"
                  style="margin-left: 10px;margin-top: 5px"
                  size="mini"
                  type="primary"
                  @click="goWarehouse(scope.row)">出库
              </el-button>
              <el-button
                  v-if="scope.row.state==0"
                  style="margin-top: 5px"
                  size="mini"
                  type="danger"
                  @click="cancelwarehouse(scope.row.id)">撤销
              </el-button>
              <el-button
                  v-if="scope.row.state==0"
                  style="margin-top: 5px"
                  size="mini"
                  type="warning"
                  @click="openEditDiolog(scope.row)">编辑
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </template>

      <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="pageNum"
          :page-sizes="pagelist"
          :page-size="pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="total"
      ></el-pagination>
    </div>


  <!-- 订单药品详情 -->
    <el-dialog
        width="75%"
        title="药品出库单"
        style="text-align: center"
        :visible.sync="detailVisible"
    >
      <el-descriptions class="margin-top" title="订单详情" :column="4" size="mini" :border="true" >
        <el-descriptions-item label="出库人:" >{{detailoutName}}</el-descriptions-item>
        <el-descriptions-item label="订单编号:">{{detailOrdernum}}</el-descriptions-item>
        <el-descriptions-item label="订单总价:">￥{{detailTotaoprice}}元</el-descriptions-item>
        <el-descriptions-item label="出库日期:">{{detailCreatetime}}</el-descriptions-item>
      </el-descriptions>
      <hr>
      <el-table
          :data="detailList"
          style="width: 100%"
          :row-class-name="tableRowClassName">
        <el-table-column prop="id" label="#" width="30px"></el-table-column>
        <el-table-column prop="medicine.drugnum" label="药品编号"></el-table-column>
        <el-table-column prop="medicine.drugname" label="药品名称"></el-table-column>
        <el-table-column prop="medicine.specification" label="规格"></el-table-column>
        <el-table-column prop="medicine.unit" label="单位"></el-table-column>
        <el-table-column prop="count" label="数量"></el-table-column>
        <el-table-column prop="medicine.buyprice" label="进货价（元）"></el-table-column>
        <el-table-column prop="sumPrice" label="金额（元）"></el-table-column>
        <el-table-column prop="desc" label="备注"></el-table-column>
        <el-table-column prop="createtime" label="购买日期"></el-table-column>
      </el-table>
    </el-dialog>


  <!--创建药品入库订单-->

    <el-dialog title="添加药品过期单" :visible.sync="addFormVisible"  @close="closeAddForm" :close-on-click-modal="false" width="80%">
      <el-form ref="addFormRef" :rules="addFormRules" :model="addForm" label-width="100px"  style="margin-left: 10px;width: 100%">

        <el-form-item label="出库人" prop="outname">
          <el-input  clearable v-model="addForm.outname"  style="margin-bottom: 10px;width: 200px"></el-input>
        </el-form-item>

        <el-form-item label="出库日期" prop="createtime">
          <el-date-picker
              v-model="addForm.createtime"
              type="date"
              :editable="false"
              value-format="yyyy-MM-dd"
              format="yyyy-MM-dd"
              placeholder="选择日期">
          </el-date-picker>
        </el-form-item>

        <el-form-item label="订单备注" prop="desc">
          <el-input type="textarea" v-model="addForm.desc"></el-input>
        </el-form-item>

        <el-form-item label="出库药品" prop="warehouseDetailVos">
          <el-button type="warning" @click="innerDrugVisible=true">选择药品</el-button>
          <el-table
              style="width:1500px"
              :data="selectDrugList"
              :row-class-name="tableRowClassName"
          >
            <el-table-column
                label="#"
                type="index"
                width="50">
            </el-table-column>
<!--            <el-table-column prop="drugnum" label="药品编码" width="90px"></el-table-column>
            <el-table-column prop="drugname" label="名称"></el-table-column>
            <el-table-column prop="saleprice" label="销售价格"></el-table-column>
            <el-table-column prop="specification" label="规格"></el-table-column>
            <el-table-column prop="unit" label="单位"></el-table-column>
            <el-table-column prop="storecount" label="库存数量"></el-table-column>-->

            <el-table-column prop="medicine.drugnum" label="药品编码" width="80px"></el-table-column>
            <el-table-column prop="medicine.drugname" label="名称"></el-table-column>
            <el-table-column prop="medicine.specification" label="规格"></el-table-column>
<!--            <el-table-column prop="medicine.unit" label="单位"></el-table-column>-->
            <el-table-column prop="medicine.storecount" label="库存数量"></el-table-column>
            <el-table-column prop="medicine.buyprice" label="进货价格"></el-table-column>
            <el-table-column
                label="数量"
                prop="count"
                width="150px">
              <template slot-scope="scope">
                <el-input-number v-model="scope.row.count"  @change="handleChange(scope.row)" size="mini" :min="1" :max="100" label="描述文字"></el-input-number>
              </template>
            </el-table-column>
            <el-table-column
                label="小计"
                prop="sumPrice"
                width="90px">
            </el-table-column>

            <el-table-column label="操作" width="90">
              <template slot-scope="scope">
                <el-button
                    size="mini"
                    type="primary"
                    @click="cancelSelect(scope.row.medicine.id)">删除
                </el-button>
              </template>
            </el-table-column>

            <el-table-column
                label="备注"
                prop="desc"
                width="150px">
              <template slot-scope="scope">
                <el-input v-model="scope.row.desc" size="mini" :min="1" :max="100"></el-input>
              </template>
            </el-table-column>
          </el-table>
        </el-form-item>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button style="color: #0077ff" >合计：{{price2}}元</el-button>
        <el-button  @click="closeAddForm">取 消</el-button>
        <el-button type="primary" @click="addConfirm()">确 定</el-button>
      </div>
    </el-dialog>


    <!--编辑药品入库订单-->

    <el-dialog title="编辑药品过期单" :visible.sync="editFormVisiable"  @close="closeEditForm" :close-on-click-modal="false" width="80%">
      <el-form ref="editFormRef" :rules="editFormRules" :model="editForm" label-width="100px"  style="margin-left: 10px;width: 100%">

        <el-form-item label="出库人" prop="outname">
          <el-input  clearable v-model="editForm.outname"  style="margin-bottom: 10px;width: 200px"></el-input>
        </el-form-item>

        <el-form-item label="采购日期" prop="createtime">
          <el-date-picker
              v-model="editForm.createtime"
              type="date"
              :editable="false"
              value-format="yyyy-MM-dd"
              format="yyyy-MM-dd"
              placeholder="选择日期">
          </el-date-picker>
        </el-form-item>

        <el-form-item label="订单备注" prop="desc">
          <el-input type="textarea" v-model="editForm.desc"></el-input>
        </el-form-item>

        <el-form-item label="出库药品" prop="warehouseDetailVos">
          <el-button type="warning" @click="innerDrugVisible=true">选择药品</el-button>
          <el-table
              style="width:1500px"
              :data="selectDrugList"
              :row-class-name="tableRowClassName"
          >
            <el-table-column
                label="#"
                type="index"
                width="50">
            </el-table-column>
            <!--            <el-table-column prop="drugnum" label="药品编码" width="90px"></el-table-column>
                        <el-table-column prop="drugname" label="名称"></el-table-column>
                        <el-table-column prop="saleprice" label="销售价格"></el-table-column>
                        <el-table-column prop="specification" label="规格"></el-table-column>
                        <el-table-column prop="unit" label="单位"></el-table-column>
                        <el-table-column prop="storecount" label="库存数量"></el-table-column>-->

            <el-table-column prop="medicine.drugnum" label="药品编码" width="80px"></el-table-column>
            <el-table-column prop="medicine.drugname" label="名称"></el-table-column>
            <el-table-column prop="medicine.specification" label="规格"></el-table-column>
            <!--            <el-table-column prop="medicine.unit" label="单位"></el-table-column>-->
            <el-table-column prop="medicine.storecount" label="库存数量"></el-table-column>
            <el-table-column prop="medicine.buyprice" label="进货价格"></el-table-column>
            <el-table-column
                label="数量"
                prop="count"
                width="150px">
              <template slot-scope="scope">
                <el-input-number v-model="scope.row.count"  @change="edithandleChange(scope.row)" size="mini" :min="1" :max="100" label="描述文字"></el-input-number>
              </template>
            </el-table-column>
            <el-table-column
                label="小计"
                prop="sumPrice"
                width="90px">
            </el-table-column>

            <el-table-column label="操作" width="90">
              <template slot-scope="scope">
                <el-button
                    size="mini"
                    type="primary"
                    @click="editcancelSelect(scope.row.medicine.id)">删除
                </el-button>
              </template>
            </el-table-column>

            <el-table-column
                label="备注"
                prop="desc"
                width="150px">
              <template slot-scope="scope">
                <el-input v-model="scope.row.desc" size="mini" :min="1" :max="100"></el-input>
              </template>
            </el-table-column>
          </el-table>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button style="color: #0077ff" >合计:{{price3}}元</el-button>
        <el-button  @click="closeEditForm">取 消</el-button>
        <el-button type="primary" @click="editConfirm()">确 定</el-button>
      </div>
    </el-dialog>


    <!--药品信息对话框-->
    <el-dialog
        width="90%"
        title="选择药品信息"
        :visible.sync="innerDrugVisible"
        append-to-body>
      <div>
        <template>

          <el-input placeholder="请输入药品名称" v-model="drugname"  clearable  @clear="searchDrug()"
                    style="width: 300px;float: right;margin-right: 20px;margin-bottom:10px;border: #333744">
            <el-button slot="append" icon="el-icon-search" @click="searchDrug()"></el-button>
          </el-input>

          <el-table
              :data="drugList"
              style="width: 100%"
              :row-class-name="tableRowClassName">
            <el-table-column prop="id" label="#" width="30px"></el-table-column>
            <el-table-column label="图片" width="150">
              <template slot-scope="scope">
                <el-image
                    style="width: 100px; height: 100px"
                    :src="'http://localhost:10001/'+scope.row.imgsrc"
                    fit="cover"></el-image>
              </template>
            </el-table-column>
            <el-table-column prop="drugnum" label="编码" width="90px"></el-table-column>
            <el-table-column prop="drugname" label="名称"></el-table-column>
            <el-table-column prop="buyprice" label="采购价格"></el-table-column>
            <el-table-column prop="saleprice" label="销售价格"></el-table-column>
            <el-table-column prop="specification" label="规格"></el-table-column>
            <el-table-column prop="userway" label="用药方式"></el-table-column>
            <el-table-column prop="dose" label="服用剂量"></el-table-column>
            <el-table-column prop="usertime" label="服药时间"></el-table-column>
            <el-table-column prop="originplace" label="产地"></el-table-column>
            <el-table-column prop="storecount" label="库存数量"></el-table-column>
            <el-table-column label="操作">
              <template slot-scope="scope">
                <el-button
                    style="margin-left: 10px"
                    size="mini"
                    type="success"
                    @click="selectDrug(scope.row)">选择
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </template>

        <el-pagination
            @size-change="drugHandleSizeChange"
            @current-change="drugHandleCurrentChange"
            :current-page="drugpageNum"
            :page-sizes="drugpagelist"
            :page-size="drugpageSize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="drugtotal"
        ></el-pagination>
      </div>
    </el-dialog>


  </div>
</template>


<script>
export default {
  name: "Warehouse",
  data() {
    return {
      //过期出库== 搜素，分页，页面展示
      overduevoList: [],
      state: '',
      outname: '',
      pageNum: 1,
      pageSize: 6,
      pagelist: [2, 3, 6, 8],
      total: 0,

      //查看订单详情
      detailList: [],
      detailoutName:'',
      detailOrdernum:'',
      detailTotaoprice:'',
      detailCreatetime:'',
      detailVisible: false,


    //添加
      addForm: {totalprice:0,},
      addFormVisible: false,
      addFormRules: {
        outname:[{required: true, message: "不能为空", trigger: 'blur'}],
        createtime:[{required: true, message: "不能为空", trigger: 'blur'}],
      },
      price2:0,//代替表单总价

      //添加，编辑
      selectDrugList: [],

      //编辑
      editForm:{olderName:"",olderId:0,totalprice: 0,saletime:"",desc:'',deliveryDetailVos:[]},
      editFormVisiable:false,
      editFormRules:{
        outname:[{required: true, message: "不能为空", trigger: 'blur'}],
        createtime:[{required: true, message: "不能为空", trigger: 'blur'}],
      },
      price3:0,

      //药品信息
      innerDrugVisible: false,
      drugList: [],
      drugname: '',
      drugpageNum: 1,
      drugpageSize: 3,
      drugpagelist: [2, 3, 6, 8],
      drugtotal: 0,

    }
  },
  methods: {
    //打开编辑对话框
    openEditDiolog(overduevo){
      this.editFormVisiable=true;
      this.editForm=overduevo;
      this.price3=this.editForm.totalprice;
      this.selectDrugList =this.editForm.overdueDetailVos;
    },
    //编辑==改变药品数量（小计和总价）
    edithandleChange(overdueDetailVo){
      let totalprice=0;
      let price=overdueDetailVo.medicine.buyprice;
      let count=overdueDetailVo.count;
      let sumprice= price * count;
      for(let a of this.selectDrugList){
        if(overdueDetailVo.medicine.id==a.medicine.id){
          a.sumPrice=sumprice;
        }

        let price1=a.medicine.buyprice;
        let count1=a.count;
        let s= count1 * price1;
        totalprice+=s;

      }
      this.editForm.totalprice=totalprice;
      this.price3=this.editForm.totalprice;
      console.log(this.editForm.totalprice);

    },
    //编辑==删除选择的药品
    editcancelSelect(medicineId){
      this.selectDrugList.forEach((item,index)=>{
        if(item.medicine.id==medicineId){
          this.selectDrugList.splice(index,1);
          this.editForm.totalprice=this.editForm.totalprice-item.sumPrice;
        }
        this.price3=this.editForm.totalprice;
      })
    },
    //编辑==取消编辑
    closeEditForm(){
      this.editFormVisiable=false;
      this.$refs.editFormRef.resetFields();
      this.initoverdueVolist();
    },
    //编辑==确定修改订单
    editConfirm(){
      if(this.selectDrugList.length<1){
        alert("请选择药品！");
        return;
      }
      this.$refs.editFormRef.validate((valid)=>{
        if(!valid){return};
        this.editForm.overdueDetailVos=this.selectDrugList;
        this.$axios.post("/overdue/modify",this.editForm).then((res)=>{
          if(res.data.code==200){
            this.$message({
              message: res.data.msg,
              type: 'success',
              duration: 1000
            });
            this.initoverdueVolist();
            this.editFormVisiable=false;
            this.$refs.editFormRef.resetFields();
          }else {
            this.$message({
              message: res.data.msg,
              type: 'success',
              duration: 1000
            });
          }

        });
      })
    },

    //添加==删除出库订单中的药品
    cancelSelect(id){
      this.selectDrugList.forEach((item,index)=>{
        if(item.medicine.id==id){
          this.selectDrugList.splice(index,1);
          this.addForm.totalprice=this.addForm.totalprice-item.sumPrice;
        }
        this.price2=this.addForm.totalprice;
      })
    },
    //添加,编辑==选择药品，添加进去集合
    selectDrug(medicine) {
      for(let c of this.selectDrugList){
        if(c.medicine.id==medicine.id){
          this.innerDrugVisible = false;
          this.$message({
            message: '您已经添加过此药品',
            type: 'error',
            duration: 1000
          });
          return;
        }
      }
      let overdueDetailVo={medicine:medicine,count: 1,sumPrice:medicine.buyprice};
      this.selectDrugList.push(overdueDetailVo);
      this.addForm.totalprice +=medicine.buyprice;
      this.price2=this.addForm.totalprice;
      this.editForm.totalprice +=medicine.buyprice;
      this.price3=this.editForm.totalprice;
      this.innerDrugVisible = false;
    },
    //添加==改变药品数量--价格小计,总计
    handleChange(overdueDetailVo){
      let totalprice=0;
     let price=overdueDetailVo.medicine.buyprice;
     let count=overdueDetailVo.count;
     let sumprice= price * count;
        for(let a of this.selectDrugList){
          if(overdueDetailVo.medicine.id==a.medicine.id){
            a.sumPrice=sumprice;
          }

          let price1=a.medicine.buyprice;
          let count1=a.count;
          let s= count1 * price1;
         totalprice+=s;

        }
          this.addForm.totalprice=totalprice;
          this.price2=this.addForm.totalprice;
        console.log(this.addForm.totalprice);

    },
    //打开添加订单对话框
    openAddDialog() {
      this.addFormVisible = true;
      this.addForm={};
      this.addForm.totalprice=0;
      let name=sessionStorage.getItem("username");
      this.$set(this.addForm,'outname',name);
      this.$set(this.addForm,'createtime',new Date());
      this.selectDrugList=[];
      this.price2=0;
    },
    //添加==关闭添加对话框(取消添加)订单
    closeAddForm() {
      this.addFormVisible = false;
      this.$refs.addFormRef.resetFields();
    },
    //添加==确定添加订单
    addConfirm() {
      if(this.selectDrugList.length<1){
        alert("请选择药品！");
        return;
      }
      this.$refs.addFormRef.validate((valid)=>{
        if(!valid){return};
      this.addForm.overdueDetailVos=this.selectDrugList;
      this.$axios.post("/overdue/add",this.addForm).then((res)=>{
        if(res.data.code==200){
          this.$message({
            message: res.data.msg,
            type: 'success',
            duration: 1000
          });
          this.initoverdueVolist();
          this.addFormVisible=false;
          this.$refs.addFormRef.resetFields();
        }else {
          this.$message({
            message: res.data.msg,
            type: 'success',
            duration: 1000
          });
        }

      });
      })
    },

    //出库（确定出库）
    goWarehouse(overdueVo) {
      this.$confirm("你确定要出库吗？除库后库存数量将减少，无法修改订单", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.$axios.post("/overdue/reduceOverdue", overdueVo).then((res) => {
          if (res.data.code == 200) {
            this.$message({
              message: res.data.msg,
              type: 'success',
              duration: 1100
            });
            this.innerVisible = false;
            this.initoverdueVolist();
            this.initDrugList();
          } else {
            this.$message({
              message: res.data.msg,
              type: 'error',
              duration: 1000
            });
          }
        })
      }).catch(() => {
        this.$message({
          type: "info",
          message: "取消出库成功"
        })
      })
    },
    //撤销
    cancelwarehouse(id) {
      this.$confirm("撤销后单据将无法修改，你确定要撤销吗？", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        this.$axios.get("/overdue/cancel/" + id).then((res) => {
          if (res.data.code == 200) {
            this.$message({
              message: res.data.msg,
              type: 'success',
              duration: 1000
            });

            this.initoverdueVolist();
          } else {
            this.$message({
              message: res.data.msg,
              type: 'error',
              duration: 1000
            });
          }
        });
      }).catch(() => {
        this.$message({
          type: "info",
          message: "取消成功"
        })
      })
    },

    //查看入库表的订单详情
    searchDetail(overduevo) {
      this.detailVisible=true;
      this.detailList=overduevo.overdueDetailVos;
      this.detailoutName=overduevo.outname;
      this.detailOrdernum=overduevo.ordernum;
      this.detailTotaoprice=overduevo.totalprice;
      this.detailCreatetime=overduevo.createtime;
    },
    handleSizeChange(newSize) {
      this.pageNum = 1;
      this.pageSize = newSize;
      this.initoverdueVolist();
    },
    handleCurrentChange(newPage) {
      this.pageNum = newPage;
      this.initoverdueVolist();
    },
    search() {
      this.pageNum = 1;
      this.initoverdueVolist();
    },

    initoverdueVolist() {
      this.$axios.get("/overdue/searchList", {
        params: {
          now: this.pageNum,
          size: this.pageSize,
          state: this.state,
          outname: this.outname,
        }
      }).then((res) => {
        if (res.data.code == 200) {
          this.overduevoList = res.data.data.list;
          console.log(this.overduevoList);
          this.total = res.data.data.total;
          this.pageNum = res.data.data.pageNum;
          this.pageSize = res.data.data.pageSize;
        } else {
          this.$message({
            message: res.data.msg,
            type: 'error',
            duration: 1000
          });
        }
      })
    },

    tableRowClassName({rowIndex}) {
      if (rowIndex === 0) {
        return 'white-row'; // 第一行为白色
      } else if (rowIndex % 4 === 1) {
        return 'warning-row'; // 第二行和每隔三行后的行为绿色
      } else if (rowIndex % 2 === 0) {
        return ''; // 第二行和每隔三行后的行为绿色
      } else if (rowIndex % 3 === 2) {
        return 'white-row'; // 第三行和每隔三行后的行为白色
      } else {
        return 'success-row'; // 每隔三行后的行为黄色
      }
    },

    //选择药品-页码1
    drugHandleSizeChange(newSize) {
      this.drugpageNum = 1;
      this.drugpageSize = newSize;
      this.initDrugList();
    },
    //选择药品-页码2
    drugHandleCurrentChange(newPage) {
      this.drugpageNum = newPage;
      this.initDrugList();
    },
    //选择药品-搜素
    searchDrug() {
      this.drugpageNum = 1;
      this.initDrugList();
    },
    //选择药品-查寻
    initDrugList() {
      this.$axios.get("/medicine/search", {
        params: {
          now: this.drugpageNum,
          size: this.drugpageSize,
          drugname: this.drugname
        }
      }).then((res) => {
        if (res.data.code == 200) {
          this.drugList = res.data.data.list;
          this.drugtotal = res.data.data.total;
          this.drugpageNum = res.data.data.pageNum;
          this.drugpageSize = res.data.data.pageSize;
        } else {
          this.$message({
            message: res.data.msg,
            type: 'error',
            duration: 1000
          });
        }
      })
    },
  },
  created() {
    this.initoverdueVolist();
    this.initDrugList();
  },
}

</script>

<style scoped>
.input-with-select {
  background-color: #fff;
  color: #2d3a4b;
}

.el-table .warning-row {
  background: oldlace;
}

.el-table .success-row {
  background: #f0f9eb;
}

.avatar-uploader .el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.avatar-uploader .el-upload:hover {
  border-color: #409EFF;
}

.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}

.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
</style>
